import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for(int i=0;i<n;i++) {
            arr[i] = in.nextInt();
        }
        Arrays.sort(arr);
        int b = arr[n-1];
        int flag = 1;
        for(int i=0;i<n-1;i++) {
            int a = arr[i];
            int x = b/a;
            if(b%a!=0|| ((x-1)&x)!=0) {
                flag = 0;
                break;
            }
        }
        System.out.print(flag==0?"NO":"YES");
    }
}